package com.bw.zg2.utils

import android.content.Context
import androidx.room.Room
import com.bw.zg2.db.ShoppingDb

/**
 *
 * @ClassName: DbUtils
 * @Description: 数据库工具类
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/18 12:18 PM
 * @Version: 1.0
 */
class DbUtils {
    companion object {
        //声明ShoppingDb
        lateinit var shopDB: ShoppingDb
        fun init(context: Context) {
            shopDB = Room.databaseBuilder(context, ShoppingDb::class.java, "shopping.db")
                .allowMainThreadQueries()//允许数据库在主线程查询
                .build()
        }
//        fun getShopDB(): ShoppingDb {
//            return shopDB
//        }
    }
}